<template>
  <template v-for="menu in menuList">
    <el-submenu :index="menu.path" v-if="menu.children && menu.children.length > 0 && menu.children[0].menuType == 1" :key="menu._id">
      <template #title>
        <i :class="menu.icon"></i> <span>{{ menu.menuName }}</span>
      </template>
      <TreeMenu :menuList="menu.children"></TreeMenu>
    </el-submenu>
    <el-menu-item v-else-if="menu.menuType == 1" :index="menu.path" :class="menu.icon" :key="menu._id">{{ menu.menuName }}</el-menu-item>
  </template>
</template>
<script>
export default {
  name: 'TreeMenu',
  props: {
    menuList: {
      type: Array,
      default() {
        return [];
      },
    },
  },
};
</script>
